package com.hdyg.sixg.mvp.presenter;

import com.hdyg.sixg.httpUtil.HttpCallback;
import com.hdyg.sixg.mvp.Contrant.CRegistForgetpwd;
import com.hdyg.sixg.mvp.base.BasePresenter;
import com.hdyg.sixg.util.ToastUtil;
import java.util.Map;

/**
 * @author CZB
 * @describe 注册/忘记密码
 * @time 2019/4/10 9:54
 */
public class PRegistForgetPwd extends BasePresenter implements CRegistForgetpwd.IPRegistForgetpwd {

    private CRegistForgetpwd.IVRegistForgetpwd mView;

    public PRegistForgetPwd(CRegistForgetpwd.IVRegistForgetpwd mView) {
        this.mView = mView;
    }


    @Override
    public void pGetRegist(String path, Map<String, String> params) {

        mModel.post(path, params, new HttpCallback(true) {
            @Override
            public void onSuccess(Object o) {
                mView.vGetRegistSuccess(o.toString());
            }

            @Override
            public void onFail(String code, String error) {
                ToastUtil.show(error);
            }
        });

    }

    @Override
    public void pGetSendCode(String path, Map<String, String> params) {

        mModel.post(path, params, new HttpCallback(true) {
            @Override
            public void onSuccess(Object o) {
                mView.vGetSendCodeSuccess(o.toString());
            }

            @Override
            public void onFail(String code, String error) {
                ToastUtil.show(error);
            }
        });
    }

    @Override
    public void pGetForgetPwd(String path, Map<String, String> params) {
        mModel.post(path, params, new HttpCallback(true) {
            @Override
            public void onSuccess(Object o) {
                mView.vGetForgetPwdSuccess(o.toString());
            }

            @Override
            public void onFail(String code, String error) {
                ToastUtil.show(error);
            }
        });
    }
}
